<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterActivityTablesAddImages extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->unsignedTinyInteger('isAttendEd')->default(0)->comment('是否关注公众号')->after('notifyAheadDays');
            $table->string('pushText', 300)->default('')->comment('推送文案')->after('notifyAheadDays');
        });

        Schema::table('shop_archives', function (Blueprint $table) {
            $table->string('manageEWechatUrl', 300)->default('')->comment('店长企微二维码URI')->after('createdAt');
            $table->string('manageEWechatPic', 300)->default('')->comment('店长企微二维码图片地址')->after('createdAt');
        });

        Schema::table('activity_image_mappings', function (Blueprint $table) {
            $table->unsignedInteger('type')->default(0)->comment('图片类型 见model枚举')->after('imageUrl');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->dropColumn('isAttendEd');
            $table->dropColumn('pushText');
        });
        Schema::table('shop_archives', function (Blueprint $table) {
            $table->dropColumn('manageEWechatUrl');
            $table->dropColumn('manageEWechatPic');
        });
        Schema::table('activity_image_mappings', function (Blueprint $table) {
            $table->dropColumn('type');
        });
    }
}
